<%--
  Created by IntelliJ IDEA.
  User: 10352
  Date: 2022/8/17
  Time: 9:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
    <h1>海淀区工商局组织机构管理系统</h1>
    <input type="button" onclick="location.href='add.jsp'" value="添加组织机构">
    <table border="1">
        <tr>
            <th>组织机构名称</th>
            <th>负责人</th>
            <th>业务状态</th>
            <th>创建日期</th>
            <th>操作</th>
        </tr>
        <c:forEach var="show" items="${show}">
         <tr>
             <td>${show.name}</td>
             <td>${show.principaName}</td>
             <td>${show.status==0?"启用业务":"禁用业务"}</td>
             <td>${show.createDete}</td>
             <td><a onclick="xiuGai('${show.status}','${show.principaName}')" href="javascript:void(0)">${show.status==1?"启用业务":"禁用业务"}</a></td>
         </tr>
        </c:forEach>
    </table>

</body>
<script src="js/jquery-1.8.3.min.js"></script>
<script>
    function xiuGai(w,e){
        var temp = confirm("确定要暂停业务吗?");
        if(temp==true){
            $.post("UpdateServlet",{"status":w,"name":e},function (data) {
                if (data == "true") {
                    location.href="index.jsp"
                } else {
                    location.href="index.jsp"
                }
            })
        }
    }
</script>
</html>
